Using SAML Artifact |
|
Before you begin this task: You must send a request to the identity provider to get a SAML assertion containing a SAML artifact. To view a sample request, refer to SAML Assertion Request and to view its response, refer to SAML Assertion Response. The SAML artifact in the response is as follows:
<samlp:AssertionArtifact xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol"> MDF3eiA3HTMvRoDydILiGLihWu7akA65UvZOe0p5hka4siLYQInR/N1C </samlp:AssertionArtifact>
This SAML artifact can be used as URL parameter. To use the SAML Artifact as an URL parameter you must encode it as a URl parameter and then add it to the URL itself.
- The following Javascript sample code encodeURI() with the URL variable name SAMLart encodes the artifact to URL:
function addParameterToURL(url, name, value) { var questionMarkPosition = url.indexOf("?"); var addAmpersand = questionMarkPosition>=0 && questionMarkPosition<url.length-1 && ! /&$/.test(url); var addQuestionMark = questionMarkPosition<=0; if (addQuestionMark) url += "?"; if (addAmpersand) url += "&"; url += name + "=" + encodeURIComponent(value); return url; }
- The following sample code invokes the function encodeURI():
addParameterToURL(url, 'SAMLart' , samlArtifactFromRequest);
The sample URL returned is http://srv-nl-sso1/test/com.eibus.web.soap.Gateway.wcp?SAMLart=MDF3eiA3HTMvRoDydILiGLihWu7akA65UvZOe0p5hka4siLYQInR%2FN1C.
This URL can be used in any request to the Web server.